<template>
	<view class="uni_box home">
		<!-- <navbar title='课程中心' :yin="true">
		</navbar> -->
		<!-- <u-loadmore :status="status" :icon-type="iconType" :load-text="loadText" /> -->
		<view class="content">
			<Nheader @getmine="getmine"></Nheader>
			<view class="htwo">
				<u-swiper :list="swlist" height="300"></u-swiper>
			</view>
			<view class="gongview">
				<image class="gongicon" src="/static/img/gongicon.png"></image>
				<text class="gxian"></text>
				<view class="gongcont" v-if="lamp">
					<u-notice-bar mode="vertical" :list="lamp" bg-color="none" :volume-icon="false" color="#666666" style="width: 100%;"></u-notice-bar>
				</view>
			</view>
			<view class="hthree">
				<view class="refu">
					<image class="remen" src="/static/img/remen.png"></image>
					<text class="htit">热门服务</text>
					
				</view>
				
				<view class="hlist">
					<view class="hitem" v-for="(item,index) in hList" :key="index" @click="navClick(item)">
						<image class="hicon" :src="item.img"></image>
						<text>{{item.name}}</text>
					</view>
				</view>
			</view>

			<view class="hfour">
				<view class="hfhead">
					<view class="refu" style="margin-bottom: 0;">
						<image class="remen" src="/static/img/fenicon.png"></image>
						<!-- <text class="htit">热门服务</text> -->
						<text class="htit">每日分享</text>
					</view>
					
					<view class="gengview" @click="moreClick(1)">
						<text class="geng">更多</text>
						<image class="icon_next" src="/static/img/icon_next.png"></image>
					</view>
					
				</view>
				<view class="jiulist">
					<view class="jiuitem" v-for="(item,index) in newinfo" :key="index" @click="moredetail(item)">
						<image class="hebg" :src="item.thumbnail"></image>
						<view class="jiuright">
							<text class="jname">{{item.title}}</text>
							<!-- <view class="qian">
								<text class="qianjiu">{{item.type_name}}</text>
							</view> -->
							<view class="yanview">
								<text class="yantime">{{item.created_at}}</text>
								<image class="icon_eye_s" src="/static/img/icon_gk.png"></image>
								<text class="yuenum">{{item.see_number}}</text>
							</view>
						</view>
					</view>
				</view>
			</view>

			<!-- 我的侧边栏 -->
			<!-- <Mine :mshow="mshow"  @close="mineclose"></Mine> -->
			<!-- 更多服务 -->
			<MoreFuwu :moreshow="moreshow" @moreclose="moreclose"></MoreFuwu>
		</view>
	</view>
</template>

<script>
    import MoreFuwu from "@/components/MoreFuwu/MoreFuwu"; 
	export default {
		components:{
			MoreFuwu
		},
		data() {
			return {
				mshow:false,
				homeinfo:{
					
				},
				iseyes:false,
				token:uni.getStorageSync('token'),
				indicatorDots: true,
				autoplay: false,
				interval: 2000,
				duration: 500,

				status: 'loadmore',
				iconType: 'flower',
				loadText: {
					loadmore: '轻轻上拉',
					loading: '努力加载中',
					nomore: '实在没有了'
				},
				swlist: [
					// {
					// 	image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
					// 	title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					// },
				],
				hList:[
					// {id:1,name:'Ai法务',img:'/static/img/homeone.png'},
					// {id:2,name:'债务委托',img:'/static/img/hometwo.png'},
					// {id:3,name:'案件咨询',img:'/static/img/homethree.png'},
					// {id:4,name:'文书服务',img:'/static/img/icon_ws.png'},
					// {id:5,name:'共享律师',img:'/static/img/homefive.png'},
					// {id:6,name:'法律讲堂',img:'/static/img/homesix.png'},
					// {id:7,name:'违约金计算',img:'/static/img/homeseven.png'},
					// {id:8,name:'套餐服务',img:'/static/img/homefour.png'},

					// {id:8,name:'更多服务',img:'/static/img/homeeight.png'},

					{id:1,name:'Ai法务',img:'/static/img/nhone.png'},
					{id:2,name:'风险代理',img:'/static/img/nhtwo.png'},
					{id:3,name:'人工咨询',img:'/static/img/nhthree.png'},
					{id:4,name:'明星法务',img:'/static/img/nhfour.png'},
					{id:5,name:'合同范本',img:'/static/img/nhfive.png'},
					{id:6,name:'法律讲堂',img:'/static/img/nhsix.png'},
					{id:7,name:'成为顾问',img:'/static/img/nhseven.png'},
					{id:8,name:'会员权益',img:'/static/img/nheight.png'},
				],
				moreshow:false,
				newinfo:[],
				nlist:[
					'寒雨连江夜入吴',
					'平明送客楚山孤',
					'洛阳亲友如相问',
					'一片冰心在玉壶'
				],
				lamp:[]

			}
		},
		onLoad() {
			// this.$store.commit('initWebsocket');
		},
		onShow() {
			// if(!this.info){
			// 	this.getstatistic();//用户资产
			// }
			this.gethome();//首页即可
			
		},
		onPullDownRefresh() {
			// console.log("+++")
			// // uni.stopPullDownRefresh();
			// this.getstatistic();//用户资产
			// setTimeout(() => {
			// 	uni.stopPullDownRefresh();
			// }, 1000);
		},
		methods: {
			async gethome(){
				let res = await this.$u.api.homeindex({
				});
				// console.log(res)
				this.homeinfo = res
				let swlist = res.rotation
				for(let i in swlist){
					swlist[i].image = swlist[i].img
				}
				this.swlist = swlist
				this.newinfo = res.new
				this.lamp = res.lamp
			},
			getgong(){
				this.navrouter("/pages/TPage/Gonglist");
			},
			getmine(){
				this.mshow = true
				uni.hideTabBar();
			},
			mineclose(){
				this.mshow = false
				uni.showTabBar();
			},
			geteyes(){
				this.iseyes = !this.iseyes
			},
			chainrecharge(){
				this.navrouter("/pages/TPage/Chongbi");
			},
			getlogin(){
				uni.redirectTo({
					url: '/pages/login/login'
				})
			},
			getinvite(){
				this.navrouter("/pages/TPage/Yaoqing?type=home");
			},
			navClick(item){
				let id = item.id
				if(id == 1){
					//AI法务
					this.navrouter("/pages/TPage/gtp");
				}else if(id == 2){
					//案件委托;
					this.navrouter("/pages/TPage/MyWeituo");
				}else if(id == 3){
					//案件咨询
					// this.navrouter("/pages/TPage/AnZixun");
					this.navrouter("/pages/TPage/RenGongzixun");
					
				}else if(id == 4){
					//文书服务
					// this.navrouter("/pages/TPage/Wenshu");
					// this.navrouter("/pages/TPage/MyWenshu");
					this.navrouter("/pages/TPage/SharedLawyer");
				}else if(id == 5){
					//共享律师
					this.navrouter("/pages/tabbar/HeTong");
				}else if(id == 6){
					//法律课堂
					this.navrouter("/pages/TPage/FaKetang");
				}else if(id == 7){
					//违约金计算
					// this.navrouter("/pages/TPage/Weiyuejin");
					this.navrouter("/pages/TPage/VIpGuwen");
				}else if(id == 8){
					//更多服务
					// this.moreshow = true
					//套餐服务
					this.navrouter("/pages/TPage/VIpServices");
				}
			},
			moreclose(){
				this.moreshow = false
			},
			moredetail(item){
				this.navrouter("/pages/TPage/DayMoreDetail?id="+item.id);
			},
			moreClick(){
				this.navrouter("/pages/TPage/DayMore");
			}


		}
	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #fff;
	}
	.content{
		background-color: #fff;
		padding-bottom: 130rpx;
		.asset{
			margin: 50rpx 45rpx;
			.Total-assets{
				display: flex;
				flex-direction: row;
				align-items: center;
				padding: 0 16rpx;
				.zileft{
					display: flex;
					flex-direction: column;
					.zione{
						display: flex;
						flex-direction: row;
						align-items: center;
						.zname{
							font-family: Source Han Sans CN;
							font-weight: bold;
							font-size: 30rpx;
							color: #111111;
							display: inline-block;
							margin-right: 15rpx;
						}
						.yan{
							width: 44rpx;
							height: 30rpx;
						}
					}
					.zinum{
						margin-top: 43rpx;
						font-family: Source Han Sans CN;
						font-weight: bold;
						font-size: 50rpx;
						color: #111111;
					}
				}
				.tu{
					margin-left: auto;
					width: 173rpx;
					height: 149rpx;
				}
			}
			.lian{
				height: 80rpx;
				background: #030000;
				border-radius: 40rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				font-family: Source Han Sans CN;
				font-weight: 500;
				font-size: 30rpx;
				color: #FFFFFF;
				margin: 60rpx 0 53rpx;
			}
		}

		.htwo{
			padding:20rpx 30rpx 0;
		}
		.hthree{
			margin: 40rpx 30rpx 0;
			
			.hlist{
				display: flex;
				flex-direction: row;
				flex-wrap: wrap;
				.hitem{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					width: 25%;
					margin-bottom: 35rpx;
					.hicon{
						width: 80rpx;
						height: 80rpx;
						margin-bottom: 8rpx;
					}
					text{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #666666;
					}
				}
			}
		}
		.gongview{
			margin: 30rpx 30rpx 0;
			background: #F5F5F5;
			border-radius: 5rpx;
			padding: 20rpx;
			display: flex;
			align-items: center;
			flex-direction: row;
			.gongicon{
				width: 56rpx;
				height: 28rpx;

			}
			.gxian{
				width: 1rpx;
				height: 20rpx;
				background: #CCCCCC;
				display: inline-block;
				margin: 0 20rpx;
			}
			.gongcont{
				flex: 1;
				display: flex;
				width: 70%;
				/deep/.u-notice-bar{
					padding: 0 !important;
				}
			}
		}
		.refu{
			display: flex;
			flex-direction: row;
			align-items: center;
			margin-bottom: 40rpx;
			.remen{
				margin-right: 4rpx;
				width: 40rpx;
				height: 40rpx;
			}
		}
		.htit{
			font-family: PingFang SC;
			font-weight: bold;
			font-size: 36rpx;
			color: #111111;
			display: block;
			
		}
		.hfour{
			padding: 0 30rpx;
			.hfhead{
				display: flex;
				flex-direction: row;
				align-items: center;

				.htittwo{
					font-family: PingFang SC;
					font-weight: bold;
					font-size: 36rpx;
					color: #111111;
					display: inline-block;

				}
				.gengview{
					display: flex;
					flex-direction: row;
					align-items: center;
					margin-left: auto;
					.geng{
						font-family: PingFang SC;
						font-weight: 500;
						font-size: 24rpx;
						color: #999999;
					}
					.icon_next{
						margin-left: 4rpx;
						width: 24rpx;
						height: 24rpx;
					}
				}
			}
			.jiulist{
				.jiuitem{
					padding: 20rpx 10rpx;
					display: flex;
					flex-direction: row;
					// align-items: center;
					.hebg{
						width: 200rpx;
						height: 200rpx;
						border-radius: 10rpx;
						margin-right: 30rpx;
					}
					.jiuright{
						display: flex;
						flex-direction: column;
						flex: 1;
						.jname{
							font-family: PingFang SC;
							font-weight: bold;
							font-size: 28rpx;
							color: #000000;
						}
						.qian{
							display: flex;
							flex-direction: row;
							align-items: center;
							margin: 15rpx;
							.qianjiu{
								padding: 9rpx 12rpx;
								background: #EEEEEE;
								border-radius: 4rpx;
								font-family: PingFang SC;
								font-weight: 500;
								font-size: 20rpx;
								color: #51565D;
							}
						}
						.yanview{
							display: flex;
							margin-top: auto;
							flex-direction: row;
							align-items: center;
							.yantime{
								font-family: PingFang SC;
								font-weight: 400;
								font-size: 24rpx;
								color: #999999;
							}
							.icon_eye_s{
								margin-left: auto;
								margin-right: 9rpx;
								width: 28rpx;
								height: 28rpx;
							}
							.yuenum{
								font-family: PingFang SC;
								font-weight: 400;
								font-size: 24rpx;
								color: #999999;
							}

						}
					}
				}
			}
		}
	}
</style>
